const { loginService } = require('../service/login')
module.exports = {
  login: async (ctx, next) => {
    ctx.verifyParams({
      username: { type: 'string', required: 'true' },
      password: { type: 'string', required: 'true' }
    })
    const { username, password } = ctx.request.body
    ctx.body = await loginService(username, password)
    await next()
  }
}
